package com.e3.basdoc.goodscls.service;

import java.util.List;

import com.e3.basdoc.goodscls.model.GoodsClsModel;
import com.e3.core.base.ModelCacheManager;
import com.e3.core.cache.CacheManager;

public class GoodsClsCacheManager extends ModelCacheManager<GoodsClsModel>{
	
	public final static String GOODSCLASSES_CACHE = CacheManager.DEFAULT_LRU_CACHE;
	
	public static GoodsClsCacheManager INSTANCE = new GoodsClsCacheManager();
	
	public void put(GoodsClsModel model){
		putModel(GOODSCLASSES_CACHE, model);
		Long pId = model.getParentId();
		if(pId!=null&&pId>0){
			GoodsClsModel pModel = get(pId);
			pModel.setHasChildren(true);
		}
	}

	public GoodsClsModel get(Long id) {
		return getModel(GOODSCLASSES_CACHE, id);
	}
	
	public void remove(List<Long> ids){
		removeModels(GOODSCLASSES_CACHE,ids);
	}

}
